package com.twu.biblioteca;

import java.util.ArrayList;

public class Library {
    private static Library libraryInstance;

    private ArrayList<Book> books = new ArrayList<Book>();

    public static synchronized Library getLibraryInstance() {
        if (libraryInstance == null) {
            libraryInstance = new Library();
        }

        return libraryInstance;

    }

    private Library() {
        Book book1 = new Book("0. Harry Potter");
        Book book2 = new Book("1. Hunger Games");
        Book book3 = new Book("2. Twilight");

        books.add(book1);
        books.add(book2);
        books.add(book3);
    }

    public ArrayList<Book> getBooks() {
        return books;
    }

    public void setBooks(ArrayList<Book> books) {
        this.books = books;
    }
}
